package com.xuerhua.yxt.service.impl;

import java.util.List;

import com.xuerhua.yxt.model.SysDictType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xuerhua.yxt.dao.SysDictDataMapper;
import com.xuerhua.yxt.model.SysDictData;
import com.xuerhua.yxt.page.Page;
import com.xuerhua.yxt.service.ISysDictDataService;

@Service("sysDictDataService")
public class SysDictDataServiceImpl implements ISysDictDataService {

	@Autowired
	private SysDictDataMapper sysDictDataMapper;
	
	@Override
	public int insertSelective(SysDictData record) {
		int count = sysDictDataMapper.selectCountByDictTypeId(record.getDictTypeId());
		record.setDictDataKey(String.valueOf(count + 1));
		return sysDictDataMapper.insertSelective(record);
	}

	@Override
	public SysDictData selectByPrimaryKey(SysDictData sysDictData) {
		return sysDictDataMapper.selectByPrimaryKey(sysDictData);
	}

	@Override
	public int updateByPrimaryKeySelective(SysDictData record) {
		return sysDictDataMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public List<SysDictData> selectListByDictCode(SysDictType sysDictType) {
		return sysDictDataMapper.selectListByDictCode(sysDictType);
	}

	@Override
	public List<SysDictData> selectListByPage(Page<SysDictData> page){
		return sysDictDataMapper.selectListByPage(page);
	}

	@Override
	public List<SysDictData> selectDictData(String dictCode) {
		return sysDictDataMapper.selectDictData(dictCode);
	}

}
